﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace NetFrameworkExtensions.DataLayer
{
  public interface IHierarchicalData :
    IIdentifiedData
  {
    object ParentId { get; set; }
    object Parent { get; set; }

    IList Children { get; set; }
  }

  public interface IReferenceHierarchicalData<TIdentified, TIdentifier> :
    IIdentifiedData<TIdentified, TIdentifier>,
    IHierarchicalData
    where TIdentified : class, IReferenceHierarchicalData<TIdentified, TIdentifier>
    where TIdentifier : class, IEquatable<TIdentifier>
  {
    new TIdentifier ParentId { get; set; }
    new TIdentified Parent { get; set; }

    new IList<TIdentified> Children { get; set; }
  }

  public interface IHierarchicalData<TIdentified, TIdentifier> :
    IIdentifiedData<TIdentified, TIdentifier>,
    IHierarchicalData
    where TIdentified : class, IHierarchicalData<TIdentified, TIdentifier>
    where TIdentifier : struct, IEquatable<TIdentifier>
  {
    new TIdentifier? ParentId { get; set; }
    new TIdentified Parent { get; set; }

    new IList<TIdentified> Children { get; set; }
  }
}
